package primetest.impl.controler;

import java.io.Serializable;

import javax.enterprise.context.SessionScoped;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

import org.primefaces.event.FileUploadEvent;
import org.primefaces.model.UploadedFile;

import javax.inject.Named;



@Named("fileUploadController")
@SessionScoped
public class FileUploadController implements Serializable {
	/**
	 *
	 */
	private static final long serialVersionUID = -4066033871667621570L;

	public void handleFileUpload(FileUploadEvent event) {
		System.out.println("fileUploadController");
		FacesMessage msg = new FacesMessage("Succesful", event.getFile()
				.getFileName() + " is uploaded.");
		FacesContext.getCurrentInstance().addMessage(null, msg);
	}

	public void handleFileUpload() {
		System.out.println("fileUploadController");
		FacesMessage msg = new FacesMessage("Succesful",  " is uploaded.");
		FacesContext.getCurrentInstance().addMessage(null, msg);
	}
}
